package com.web.servlet.utils;

import java.text.SimpleDateFormat;
import java.util.Calendar;

public class Utils {

	
	//获取当前系统时间
	public static String getCurrTime()
	{
		  Calendar c = Calendar.getInstance();
		  c.setTimeInMillis(System.currentTimeMillis());
		  java.util.Date d = c.getTime();
		  SimpleDateFormat sdf = new SimpleDateFormat("yyyy年MM月dd日 HH时mm分ss秒 ");
		  return sdf.format(d);

	 }
	
	// 转化字符串为十六进制编码 
	public static byte[] toStringHex(String s) 
	{ 
		byte[] baKeyword = new byte[s.length()/2]; 
		for(int i = 0; i < baKeyword.length; i++) 
		{ 
			try 
			{ 
				baKeyword[i] = (byte)(0xff & Integer.parseInt(s.substring(i*2, i*2+2),16)); 
			} 
			catch(Exception e) 
			{ 
				e.printStackTrace(); 
			} 
		}
		return baKeyword;
	} 

}
